#include <string.h>
#include <stdio.h>

int index_bf(char *S, char *T, int pos)
{
	int lenS = strlen(S);
	int lenT = strlen(T);
	int i = 0;
	int j = 0;
	int find;
	while (i < lenS)
	{
		find = 1;
		while (j < lenT)
		{
			if (S[i + j] != T[j])
			{
				find = 0;
				break;
			}
			else
			{
				j++;
			}
		}
		if (find)
		{
			return i;
		} else
		{
			i++;
		}
	}
	return -1;
}

int main(void)
{
	char * s = "I love programming very much";
	char * t = "very";
	
	int index = index_bf(s, t, 0);
	printf("index of %s is %d\n", t, index);
	return 0;
}